/*************************************************************************
	> File Name: code2.c
	> Author: 
	> Mail: 
	> Created Time: Mon 24 Nov 2025 04:28:00 PM CST
 ************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int gval=10;
int main()
{
    printf("???");
    pid_t id=fork();
    if(id==0)
    {
        while(1)
        {
        printf("子进程,gval：%d,&gval：%p,pid：%d,ppid：%d ",gval,&gval,getpid(),getppid());
        sleep(1);
        }
    }
    else
    {
        while(1)
        {
        printf("父进程,gval：%d,&gval：%p,pid：%d,ppid：%d ",gval,&gval,getpid(),getppid());
        sleep(1);
        gval+=1;
        }
    }
    return 0;
}

